<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>待填写日志FSE列表</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<link rel="stylesheet" href="../../../css/mui.min.css">
		<link rel="stylesheet" href="../../../css/global.css">
		<link rel="stylesheet" href="../../../css/style.css">
		<style type="text/css">
			#div {
				width: 0px;
				height: 0px;
				background: red;
				position: fixed;
				top: 70%;
				left: 50%;
			}
					
			/*移除底部或顶部三角,需要在删除此代码*/
			.mui-popover .mui-popover-arrow:after {
				width: 0px;
			}
			.btn_box{
				overflow: hidden;
			}		
			.item_box .item .text span{
				width: auto;
			}
		</style>
	</head>

	<body>
		<div id="div"></div>
		<div id="popover" class="mui-popover shadow popover">
			<p class="title" id="title"></p>
			<div class="btn_box">
				<span class="fl" onclick="closepop()">取消</span>
				<span class="fr red" id="quedingupdate">拨打</span>
			</div>
		</div>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 id="title" class="mui-title">待填写日志FSE列表</h1>
		</header>
		<div class="mui-content">
			<div class="item_box" id="beijian">
				
			</div>
		</div>

		<!-- js代码 start -->

		<!-- 基础js start -->
		<script src="../../../js/mui.min.js"></script>
		<script src="../../../js/utils/h.js"></script>
		<script src="../../../js/constant.js"></script>
		<script src="../../../js/common.js"></script>
		<script src="../../../js/utils/base64.js"></script>
		<script src="../../../js/utils/md5.js"></script>
		<script src="../../../js/utils/sortMap.js"></script>
		<script src="../../../js/utils/http.js"></script>
		<script src="../../../js/app.js"></script>
		<!-- 基础js end -->

		<script type="text/javascript" charset="utf-8">		
			// 关闭弹窗方法
			function closepop() {
				mui("#popover").popover('toggle', document.getElementById("div"));
			}
			
			var phoneNum;
			function callPhone(phone){
				 if(phone && phone!='无'){
					 phoneNum = phone;
					 h("#title").html("是否拨打 " + phone + " ？");
					 mui("#popover").popover('toggle', document.getElementById("div"));
				 }					 
			}; 
			
			// 获取详情的方法
			function getDetails() {
				app.showWaiting('加载中...')
				ajaxGet(BASE_URL + "cc/PlanDetails/fseFillLogCount", {
					"enginnerId": app.getUser().enginnerId
				}, function(data) {
					app.closeWaiting()
					if (data.code == 200) {
						h("#beijian").html(""); 
						var html = "";
						if (data.data && data.data.length > 0) {
							for(var i=0;i<data.data.length;i++){
								var das = data.data[i];
								var fseName = das.fseName ? das.fseName : "无";
								var isAccept = das.isAccept ? das.isAccept : "无";
								var refusalReasons = das.refusalReasons ? das.refusalReasons : "无";
								html += '<div class="item">'
								html += '<p class="bar"><span class="number">工程师名称：'+fseName+'</p>'
								html += '<div class="text" onclick="callPhone('+ isAccept +')"><span>电话：</span>'+isAccept+'</div>'
								html += '<div class="text"><span>未填写日志数量：</span>'+refusalReasons+'</div>'
								html += '</div>';
							}
							h("#beijian").html(html);
						}else{
							var html = '<div class="nodata">—— 暂无数据 ——</div>';
							h("#beijian").html(html);
						}
			
					} else {
						var html = '<div class="nodata">—— 暂无数据 ——</div>';
						h("#beijian").html(html);
						app.toast(data.msg);
					}
				}, function(errorMsg) {
					app.closeWaiting();
					var html = '<div class="nodata">—— 暂无数据 ——</div>';
					h("#beijian").html(html);
					app.toast("数据获取失败，请检查网络连接");
				});
			}
			
			(function($, doc) {
				$.init();
			
				$.plusReady(function() {
			
					// 获取详情的方法
					getDetails();
					
					// 拨打电话
					h("#quedingupdate").tap(function(){
						mui("#popover").popover('toggle', document.getElementById("div"));
						plus.device.dial(phoneNum, false); 
					})
			
				});
			
			}(mui, document));
		</script>
		<!-- js代码 end -->

	</body>

</html>
